<template>
	<view style="padding: 10rpx; background-color: #eee;">
		<NewsView v-for="(item, index) in newsList" :key="index" :title="item.title" :isTop="item.isTop"
			:author="item.author" :comments="item.comments" :time="item.time" :images="item.images" :mode="item.mode"
			:bgColor="item.bgColor" :showSearch="item.showSearch">
			<!-- 插槽部分 -->
			<!--
      <template v-slot:tips>
        <view class="slot-content">
          <text>搜索：</text>
          <view class="tag">今日金价</view>
          <view class="tag">精选好物</view>
        </view>
      </template>
      -->
		</NewsView>
	</view>
</template>

<script>
	import NewsView from "../../../components/NewsView.vue";
	import NewsData from "../../../data/news.json";

	export default {
		components: {
			NewsView
		},
		onShow() {
			this.newsList = NewsData.newsList;
			console.log("JSON数据导入成功："+JSON.stringify()); 
		},
		data() {
			return {
				newsList: NewsData.newsList 
			};
		}
	};
</script>

<style>
	.slot-content {
		display: flex;
		align-items: center;
		margin-top: 6rpx;
	}

	.tag {
		border: 1px solid #ccc;
		border-radius: 6rpx;
		padding: 2rpx 8rpx;
		margin: 0 4rpx;
		font-size: 22rpx;
		color: #666;
		background-color: #fff;
	}
</style>